#include <stdio.h>
#include <termios.h>
#include <stdlib.h>

/**
  * 关闭或启动输入回显
  */

int main() {
	struct termios info;
	int rv;

	/* read tty attributes of file descriptor 0 (i.e., stdin) */
	rv = tcgetattr(0, &info);
	if (rv == -1) {
		perror("tcgetattr");
		exit(1);
	}
	if (info.c_lflag & ECHO) {
		printf("echo is on, since its bit is 1\n");
	} else {
		printf("echo is off, since its bit is 0\n");
	}
}
